package com.zbkj.crmeb.task.tools;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.utils.DateUtil;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.zbkj.crmeb.store.model.StoreProductActive;
import com.zbkj.crmeb.store.model.StoreUserGroup;
import com.zbkj.crmeb.store.model.StoreUserGroupFeature;
import com.zbkj.crmeb.store.service.*;
import com.zbkj.crmeb.tools.service.MoneyExchangeService;
import com.zbkj.crmeb.user.model.User;
import com.zbkj.crmeb.user.service.UserService;
import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.stream.Collectors;

/**
 * 定时计算分群用户
 * @author duyb
 * @date:  2022-10-19
 */
@Slf4j
@Component
@Configuration
@EnableScheduling
public class UserGroupTask {

    @Autowired
    StoreUserGroupService storeUserGroupService;

    /**
     * 每天凌晨1点执行
     */
    @XxlJob("calculationUserGroupTask")
    public void calculationUserGroup() {
        try {
            storeUserGroupService.calculationUserGroup();
        }catch (Exception e){
            log.error("calculationUserGroup.task error ! e: " ,e);
        }
    }

}
